package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum IsDiscount {
	UNDISCOUNT(0,"不打折"),
	DISCOUNT(1,"打折");
	
	private Integer status;
	
	private String value;

	private IsDiscount(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static IsDiscount toStatus(int status) {
		if (UNDISCOUNT.status == status) {
			return UNDISCOUNT;
		} else if (DISCOUNT.status == status) {
			return DISCOUNT;
		} else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
